package com.corpgovernment.common.common;

import com.corpgovernment.common.enums.ExceptionCodeEnum;
import com.ctrip.corp.obt.generic.exception.CommonException;
import com.ctrip.corp.obt.generic.exception.ResponseStatus;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 *
 */
@Data
@Slf4j
public class CorpBusinessException extends CommonException {

    @Deprecated
    public CorpBusinessException(ExceptionCodeEnum status, String msg) {
        super(status.code(), msg);
    }

    public CorpBusinessException(Integer code, String msg) {
        super(code, msg);
    }

    @Deprecated
    public CorpBusinessException() {
        super(ExceptionCodeEnum.Alert);
    }

    @Deprecated
    public ResponseStatus getCodeEnum(){
        return new ResponseStatus() {
            @Override
            public int code() {
                return getResultCode();
            }

            @Override
            public String message() {
                return getMessage();
            }
        };
    }

    public CorpBusinessException(ResponseStatus responseStatus, Object... args) {
        super(responseStatus, args);
    }

    public CorpBusinessException(Integer resultCode, String formatMessage, Object... args) {
        super(resultCode, formatMessage, args);
    }

    public CorpBusinessException(ResponseStatus status) {
        super(status);
    }

    public String getMsg() {
        return super.getMessage();
    }

}